package com.atguigu.staservice.controller;


import com.atguigu.commonutils.Result;
import com.atguigu.staservice.service.StatisticsDailyService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-09-17
 */
@RestController
@RequestMapping("/staservice/sta")
public class StatisticsDailyController {

    @Autowired
    private StatisticsDailyService statisticsDailyService;

    @PostMapping("/registerCount/{day}")
    public Result registerCount(@PathVariable("day")String day) {
        statisticsDailyService.registerCount(day);
        return Result.ok();
    }

    //图表显示接口，日期和数量
    @GetMapping("/showData/{type}/{begin}/{end}")
    public Result showChart(@PathVariable String type,@PathVariable String begin,@PathVariable String end){
        Map<String, Object> map = statisticsDailyService.getShowData(type, begin, end);
        return Result.ok().data(map);
    }
}

